package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotate.AuotFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;


import com.sky.result.Result;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DishMapper {

    //新增菜品
    @AuotFill(value = OperationType.INSERT)
    public void addDish(Dish dish);

    @Select("select * from dish where name =#{name}")
    public Dish getByName(Dish dish);

    public Page<Dish> page(DishPageQueryDTO dto);

    public void DropByIds(List<Long> ids);
    @Select("select * from dish where id=#{id}")
    public Dish GetById(Long id);

    @AuotFill(OperationType.UPDATE)
    @Update("update dish set name =#{name},category_id =#{categoryId},price =#{price}," +
            "description =#{description},update_time =#{updateTime},update_user =#{updateUser} where id =#{id}")
    public void Update(Dish dishDTO);

    @Select("select * from dish where category_id=#{categoryId} and status =1")
    public List<DishVO> getByCategoryId(Long categoryId);

    public void deleteById(List<Long> ids);


}
